Ext.define('PJ.view.registrationmanagement.DeptTreeFrame', {
    extend: 'Ext.window.Window',
    layout: 'border',
    modal: true,// 开启不允许点击其他组件
    resizable: false,
    
    width: 440,
    height: 578,
    parentId: null,
    buttonAlign: "center",
    // 必须增加这段，强制提前加载类，这样才可以使用简写
    requires: ['PJ.view.registrationmanagement.DeptTree'],
    
    initComponent: function(){
        this.items = [{
            region: 'west',
            width: 430,
            tree:this,
            xtype: "DeptTree"
        }];
        
        this.buttons = [{
            text: '确定',
            scope: this,
            handler: this.PreClose
        }];
        this.callParent(arguments);
    },
    PreClose: function(){
        var me = this;
        var form = this.form;
        var baseForm = form.up('form').getForm();
        var deptId = baseForm.findField('searchDepId');
        var deptName = baseForm.findField('deptName');
        var dept=this.down('DeptTree');
        if(dept.deptId){
        	deptId.setValue(dept.deptId);
        	deptName.setValue(dept.deptName);
        	me.close();
        }else{
        	Orchid.alert('警告', '请选择学员单位！');
        }
    }
});
